/**
 * 
 */
package com.fita.wechat.visitor;

import java.util.Map;

import org.springframework.cache.annotation.Cacheable;

import com.demo2do.core.utils.EnumUtils;
import com.demo2do.core.visitor.AbstractObjectRoot;
import com.fita.wechat.visitor.impl.CloudContextVisitor;
import com.fita.wechat.visitor.impl.PersistentVisitor;

/**
 * 
 * @author mohanlan
 *
 */
public class ApplicationObjectRoot extends AbstractObjectRoot {
    
    private PersistentVisitor persistentVisitor;
    
    private CloudContextVisitor cloudContextVisitor;
    
    private String entityPackage;

    /**
     * @param persistentVisitor the persistentVisitor to set
     */
    public void setPersistentVisitor(PersistentVisitor persistentVisitor) {
        this.persistentVisitor = persistentVisitor;
    }
    
    /**
     * @param cloudContextVisitor the cloudContextVisitor to set
     */
    public void setCloudContextVisitor(CloudContextVisitor cloudContextVisitor) {
        this.cloudContextVisitor = cloudContextVisitor;
    }

    /**
     * 
     * @param entityPackage
     */
    public void setEntityPackage(String entityPackage) {
        this.entityPackage = entityPackage;
    }
    
    /**
     * Get persist namespace
     * 
     * @return the persistentVisitor
     */
    public PersistentVisitor getPersist() {
        return persistentVisitor;
    }
    
    /**
     * @return
     */
    public CloudContextVisitor getCloudContext() {
        return cloudContextVisitor;
    }
    
    /**
     * Get all the enums
     * 
     * @return
     */
    @SuppressWarnings("rawtypes")
    @Cacheable("enums")
    public Map<String, Enum[]> getEnums() {
        return EnumUtils.scan(entityPackage);
    }
}

